<template>
    <div>
	 	<div class="container" style="border: none;">

			

			<el-table
				:data="list"
				border
				v-loading="ifload"
				>
                <el-table-column
                	prop="id"
                	label="id"
                    align="center"
                	width="80">
                </el-table-column>
				<el-table-column
					prop="member_id"
					label="会员ID"
                    align="center"
					width="80">
				</el-table-column>
                <el-table-column
                	prop="member_name"
                	label="会员姓名"
                    align="center"
                	width="80">
                </el-table-column>
				<el-table-column
					prop="balance"
                    align="center"
					label="金额"
					width="80">
				</el-table-column>
				<el-table-column
					prop="balance_type"
                    align="center"
					label="钱包类型"
					width="120">
				</el-table-column>
				<el-table-column
					prop="note"
                    align="center"
					label="备注"
					width="100">
				</el-table-column>
				<el-table-column
					prop="type_text"
                    align="center"
					label="收益类型"
					width="100">
				</el-table-column>
				<el-table-column
					prop="bonus_from"
                    align="center"
					label="分红来源"
					width="140">
				</el-table-column>
				<el-table-column
					prop="create_time"
                    align="center"
					label="创建时间">
				</el-table-column>
			</el-table>

            <div class="pagination">
                <el-pagination background
					@current-change="handleCurrentChange"
					layout="prev, pager, next"
					:total="pages"
					:page-size="page_size">
                </el-pagination>
            </div>
		</div>

 	</div>
</template>

<script type="text/javascript">
import {download} from '@/components/js/request'
export default{
	data() {
		return {
			ifload:true,
            avatarDefault:require("../../../assets/avatar_default.png" ),
			list:[],
            typeName:[],
            sourceType:[],

			page:1,
			page_size:10,
			pages:0,

			search:{
				member_id:'',
				balance_type:'',
			}
		}
	},
	created() {
		this.$nextTick(()=>{
			this.getData();
		})
	},
	computed:{
	},
	methods:{
		getData() {
                this.search.member_id = this.$route.query.member_id
                this.search.balance_type = this.$route.query.balance_type
			let params = {
				page:this.page,
				page_size:this.page_size,
				search:JSON.stringify(this.search)
			}
			this.ifload = true;
			this.$post_('finance/balance/balance-log',params,(res) => {
				console.log(res);
				if(res.code=='0'){
					this.list = res.data;
					this.pages = Number(res.extend.pages);
                    this.typeName = res.extend.type_name;
                    this.sourceType = res.extend.source_type;
					this.ifload = false;
				}
			});
		},
        // 分页导航
        handleCurrentChange(val) {
            this.page = val;
            this.getData();
        },
        //余额明细
        balance_log() {
            this.$router.push({path:'/page/member/member-add'});
        },
		//搜索
		searchRes() {
			this.page = 1;
			this.getData();
		},

	}
}
</script>

<style type="text/css">
    thead tr th{
        text-align: center;
    }
    .red{
        color: #ff0000;
    }
	.search{
		margin-bottom: 10px;
	}
</style>
